package org.vectrics.common.db;

import org.vectrics.common.util.DateSync;
import org.vectrics.hibernate.ThreadProperties;
import org.vectrics.user.Person;

public class NotesService {

	public NotesService() {
		super();
	}

	
	public ObjectNote createNote(Person author, String objectType, String id) {
		ObjectNote note = new ObjectNote();
		note.setDateCreated(DateSync.getCurrentTime());
		note.setObjectKey(id);
		note.setObjectType(objectType);
		note.setAuthor(author);
		return(note);
	}

	
	public void updateNote(ObjectNote note) {
		ThreadProperties.getSession().update(note);
	}
	
	public ObjectNote findNote(Long id) {
		ObjectNote note = (ObjectNote)ThreadProperties.getSession().load(ObjectNote.class, id);
		return(note);
	}
	
}
